package org.qiyu.live.user.provider;

import jakarta.annotation.Resource;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.qiyu.live.user.dto.UserLoginDTO;
import org.qiyu.live.user.provider.Service.IUserPhoneService;
import org.qiyu.live.user.provider.Service.IUserService;
import org.qiyu.live.user.provider.Service.IUserTagService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;


/**
 * @Author idea
 * @Date: Created in 15:39 2023/4/16
 * @Description 用户中台服务提供者
 */

@SpringBootApplication
@EnableDubbo
@EnableDiscoveryClient
public class UserProviderApplication implements CommandLineRunner {

    private static final Logger LOGGER = LoggerFactory.getLogger(UserProviderApplication.class);

    @Resource
    private IUserTagService userTagService;
    @Resource
    private IUserService userService;
    @Resource
    private IUserPhoneService userPhoneService;

    public static void main(String[] args) {
        SpringApplication springApplication = new SpringApplication(UserProviderApplication.class);
        springApplication.setWebApplicationType(WebApplicationType.NONE);
        springApplication.run(args);
    }

    @Override
    public void run(String... args) throws Exception {
    String phone ="1789829049";
        UserLoginDTO login = userPhoneService.login(phone);
        System.out.println(login);
        System.out.println(userPhoneService.queryByUserId(login.getUserId()));

    }
}
